package com.practice.bootdemo.controller;

import com.practice.bootdemo.common.R;
import com.practice.bootdemo.config.DataObjBindConfig;
import com.practice.bootdemo.service.AnimalService;
import com.practice.bootdemo.service.impl.DogServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author :zhoushunquan
 * @description: 一个接口多个实现类测试
 * @create date: 2022-03-24 17:25:33
 */


@RestController
@RequestMapping(value = "dataBind")
public class DataObjBindController {

//  读取配置文件注入测试
    @Autowired
    DataObjBindConfig dataObjBind;

//    一个接口多个实现类测试
    @Autowired
    DogServiceImpl dogService;


    @Autowired
    @Qualifier("CatService")
    AnimalService animalService;


    @PostMapping(value = "getDataObjBind")
    public R getDataObjBind() {
        return R.ok(dataObjBind);
    }

    @PostMapping(value = "dog")
    public R testAutoWiredDog() {
        dogService.printTest();
        return R.ok("");
    }

    @PostMapping(value = "cat")
    public R testAutoWiredCat() {
        animalService.printTest();
        return R.ok("");
    }
}